package com.example.iorder.util;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.example.iorder.R;

public class AnimationHandler {
	public static void expandView(Context context, View viewToExpand) {
		Animation a = AnimationUtils.loadAnimation(context, R.anim.expand);
		if (a != null) {
			a.reset();
			if (viewToExpand != null) {
				viewToExpand.clearAnimation();
				viewToExpand.startAnimation(a);
			}
		}
	}
	
	public static void collapseView(Context context, View viewToCollapse) {
		Animation a = AnimationUtils.loadAnimation(context, R.anim.collapse);
		if (a != null) {
			a.reset();
			if (viewToCollapse != null) {
				viewToCollapse.clearAnimation();
				viewToCollapse.startAnimation(a);
			}
		}
	}
	
	public static void addSlideRightToLeftAnim(Activity activity) {
		activity.overridePendingTransition(R.anim.push_right_out, R.anim.push_right_in);
	}
}
